class Announcement < ActiveRecord::Base
  # Allow Tagging
  acts_as_taggable
  
  acts_as_list
  
  validates_presence_of :title
  validates_presence_of :body
  
  named_url :key => 'title', :url_column => 'url_slug'
  
  acts_as_authored
  
  def summary(length = 30, end_string = ' …')
      words = body.split()
      words[0..(length-1)].join(' ') + (words.length > length ? end_string : '')
  end
end
